<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page
import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<div class="loginpage">
	<div class="container row-fluid">
		<div class="span6 login-left hidden-phone">
		</div>
		<div id="login" class="span6 login-right">
			<div class="login-cont">
				<h3> 登录 </h3> 
				<small id="tip" style="display:none"><div class="check-img"></div>
			</small>
			<c:choose>
			<c:when
			test="${shiroLoginFailure eq 'com.thon.security.CaptchaException'}">
			<small><div class="check-img"></div> <span class="error"><fmt:message
				key="login.error.captcha" /></span></small>
			</c:when>
			<c:when
			test="${shiroLoginFailure eq 'org.apache.shiro.authc.UnknownAccountException'}">
			<small><div class="check-img"></div> <span class="error"><fmt:message
				key="login.error.notExist" /></span></small>
			</c:when>
			<c:when
			test="${shiroLoginFailure eq 'org.apache.shiro.authc.IncorrectCredentialsException'}">
			<small><div class="check-img"></div> <span class="error"><fmt:message
				key="login.error.emailOrPassword" /></span></small>
			</c:when>
			<c:when
			test="${shiroLoginFailure eq 'org.apache.shiro.authc.LockedAccountException'}">
			<input type = "hidden" value="1">
			<small><div class="check-img"></div> <span class="error"><fmt:message
				key="login.error.inactive" /><a href="javascript:void(0)"
				id="resend"><fmt:message key="login.error.activeEmail" /></a></span></small>
			</c:when>
			<c:when test="${shiroLoginFailure ne null}">
			<small><div class="check-img"></div> <span class="error"><fmt:message
				key="login.error.other" /></span></small>
			</c:when>
		</c:choose>
		<div>
			<form id="login-form" action="${ctx}/login" method="post">
				<div class="input-prepend">
					<div class="e-mal-img"></div>
					<input id="username" class="e-mal" type="text" name="username"
					value="${username}" placeholder="输入手机号/用户名" />
					<div class="ok-img" id="username-ok" style="display: none;"></div>
				</div><br>
				<div class="input-prepend">
					<div class="password-img"></div>
					<input id="password" class="password" type="password"
					name="password" placeholder="输入密码" />
					<div class="ok-img hidden-phone" id="password-ok" style="display: none;"></div>
				</div><br>

				<div class="input-prepend">
					<div class="input-prepend-2">
						<div class="password-img"></div>
						<input type="text" id="captcha" name="captcha" class="captcha"
						placeholder="验证码">

					</div>
					<div class="check-img-div">
						<img title="点击更换" id="img_captcha_login"
						class="img_captcha_login" src="${ctx }/servlet/captchaCode" />
					</div>
				</div>

				<div class="change-check-img hidden-phone">
					<a class="img_captcha_login" href="javascript:void(0)"><fmt:message
						key="login.form.captcha.change" /></a>
					</div>

					<div class="login-remenber">
						<label class="pull-left">
							<input class="checkbox-login" type="checkbox" style="margin-top: 0px"/>
							记住我 
						</label>
						<h class="h3"> <a href="${ctx}/forget">忘记密码？</a> </h>
							<div class="clearfix"></div>
						</div>
						<div class="regist clearfix">
							<button type="submit" class="login color_theme pull-left">登录</button>
							<span class="h4 hidden-phone"> 还没有YAMI账号？立即<a href="${ctx}/regist">注册</a> </span>
							<span class="h4 visible-phone">立即<a href="${ctx}/regist">注册</a> </span>
						</div>
					</form>
				</div>
			</div>
		</div>
	<div class="hidden-phone">
	<div class="clearfix"></div>
	<div class="middle-line">
		<h4>快速通过合作网站登录</h4>
	</div>
	<div class="patener">
		<a href="https://api.weibo.com/oauth2/authorize?client_id=2793479754&response_type =token&redirect_uri=http://yami.lanbaoo.com/login/bind&scope=all">
			<div class="sina" style="">新浪微博登录</div>
		</a>
		<a href="https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=101152891&redirect_uri=http://yami.lanbaoo.com/login/bind&scope=all">
			<div class="tencent" style="">腾讯QQ登录</div>
		</a>
	</div>
	</div>
</div>
</div>

<c:if test="${env == 'production' }">
<script type="text/javascript">
seajs.use("${ctx}/assets/js-dist/account/login-page");
</script>
</c:if>
<c:if test="${env != 'production' }">
<script type="text/javascript">
seajs.use("${ctx}/assets/js/account/login-page");
</script>
</c:if>
